﻿<Serializable> _
Public Class clsTask
    Implements ICloneable

    Friend Name As String
    Friend Key As Int32
    Friend Duration As Int32
    Friend Pre As HashSet(Of Int32)
    Friend AggPre As HashSet(Of Int32)
    Friend Post As HashSet(Of Int32)
    '
    Friend FAZ As Int32
    Friend FEZ As Int32
    Friend SAZ As Int32
    Friend SEZ As Int32
    Friend Puffer As Int32

    Friend MPMFAZ As Int32
    Friend MPMFEZ As Int32
    Friend MPMSAZ As Int32
    Friend MPMSEZ As Int32
    Friend MPMPuffer As Int32
    Friend Position As Int32

    Friend PlanedAt As Int32
    Friend DistanceInALToPre As Int32

    Friend RenewableResources As Dictionary(Of String, Int32)
    Friend RestrictedResources As Dictionary(Of String, Int32)

    Friend PriorityValue As Int32
    Friend RegretValue1 As Int32
    Friend RegretValue2 As Int32

    Friend SelectProbability As Decimal

    Public Function Reset() As Boolean
        Try
            With Me
                .FAZ = 0
                .FEZ = 0
                .SAZ = 0
                .SEZ = 0
                .Puffer = 0
                .RegretValue1 = 0
                .RegretValue2 = 0
                .SelectProbability = 0
                .PlanedAt = 0
                Return True
            End With
        Catch ex As Exception
            Throw
        End Try
    End Function
    Public Function Clone(ByVal bempty As Boolean) As clsTask
        Dim myClone As clsTask = Me.MemberwiseClone()
        If Not Me.RenewableResources Is Nothing Then
            myClone.RenewableResources = New Dictionary(Of String, Int32)(Me.RenewableResources)
        End If
        If Not Me.RestrictedResources Is Nothing Then
            myClone.RestrictedResources = New Dictionary(Of String, Int32)(Me.RestrictedResources)
        End If
        If Not Pre Is Nothing Then
            myClone.Pre = New HashSet(Of Int32)(Me.Pre)
        End If
        If Not AggPre Is Nothing Then
            myClone.AggPre = New HashSet(Of Int32)(Me.AggPre)
        End If
        If Not Post Is Nothing Then
            myClone.Post = New HashSet(Of Int32)(Me.Post)
        End If
        myClone.Position = Me.Position
        If bempty Then
            myClone.FAZ = 0
            myClone.FEZ = 0
            myClone.SAZ = 0
            myClone.SEZ = 0
            myClone.Puffer = 0
            myClone.RegretValue1 = 0
            myClone.RegretValue2 = 0
            myClone.SelectProbability = 0
            myClone.PlanedAt = 0
            myClone.DistanceInALToPre = 0
        End If
        Return myClone
    End Function

    Public Function Clone1() As Object Implements ICloneable.Clone
        Return Me.MemberwiseClone()
    End Function
End Class
